package com.goo.integration;

import com.goo.config.RedisClientConfig;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config")
@RefreshScope
public class ConfigController {

    @Value("${useLocalCache:false}")
    private boolean useLocalCache;
    @Autowired
    private RedisClientConfig redisClientConfig;

    @ApiOperation("查询属性值")
    @RequestMapping("/get")
    public boolean get() {
        return useLocalCache;
    }

    @ApiOperation("查询属性值")
    @GetMapping("/getRedisConfig")
    public String getRedisConfig() {
        return redisClientConfig.toString();
    }


}
